#include "Astronomy/CFK5.hpp"
#include "Astronomy/Transformation.hpp"

double CFK5::CorrectionInLongitude(const double Longitude, const double Latitude, const double T)noexcept
{
    const double dT{ T * 10 };

    double Ldash = Longitude - (1.397 * dT) - (0.00031 * dT * dT);

    //Convert to radians
    Ldash = Transformation::DegreesToRadians(Ldash);

    const double value{ -0.09033 + (0.03916 * (cos(Ldash) + sin(Ldash))) * tan(Latitude) };

    return Transformation::DegreesToRadians(Transformation::DMSToDegrees(0, 0, value));
}

double CFK5::CorrectionInLatitude(const double Longitude, const double T) noexcept
{
    const double dT{T*10.0};
    double Ldash{ Longitude - (1.397 * dT) - (0.00031 * dT * dT) };

    //Convert to radians
    Ldash = Transformation::DegreesToRadians(Ldash);

    const double value{ 0.03916 * (cos(Ldash) - sin(Ldash)) };

    //return Transformation::DMSToDegrees(0, 0, value);
    return Transformation::DegreesToRadians(Transformation::DMSToDegrees(0, 0, value));


}
